<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>设置</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="css/style.css" />
		<link rel="stylesheet" href="css/icons-extra.css" />
		<link rel="stylesheet" href="css/iconfont.css" />
		<link rel="stylesheet" href="font/iconfont.css" />
		<link rel="stylesheet" type="text/css" href="css/commontCust.css" />
		<style>
			.language {
				height: 40px;
				padding: 10px 0px 0 10px;
			}
			
			.language.mui-table-view-cell .setting_right select {
				background-color: #333;
				color: #ccc;
				font-size: 12px;
				height: 30px;
				padding: 0px;
				margin: 0px;
			}
			
			.language.mui-table-view-cell .mui-pull-left {
				line-height: 20px;
				color: black;
				margin-left: 5px;
			}
			
			.mui-navigate-right:after,
			.mui-push-left:after,
			.mui-push-right:after {
				color: #000;
			}
			
			.home_top {
				padding-top: 6px;
			}
		</style>

		<style>
			.first_ul,
			.table2 {
				margin: 0 0px;
			}
			
			.set_content {
				margin-top: 0px;
				padding: 16px;
			}
			/*中英文切换*/
			
			.lang-zz {
				width: 100%;
				height: 100%;
				background: rgba(255, 255, 255, 0.2);
				position: fixed;
				left: 0px;
				top: 0px;
				z-index: 999;
			}
			
			.lang-main {
				width: 260px;
				height: auto;
				position: fixed;
				background: #aaa;
				left: 50%;
				margin-left: -130px;
				top: 50%;
				margin-top: -25%;
				border-radius: 5px;
			}
			
			.lang-main h5 {
				color: #000;
				font-size: 18px;
				text-align: center;
			}
			
			.langbox {
				width: 100%;
				height: 33px;
				padding: 0px 5%;
				line-height: 33px;
				color: #000;
			}
			
			.langbox span {
				float: right;
				line-height: 33px;
			}
			
			.lang-btn {
				width: 100%;
				height: 40px;
			}
			
			.lang-btn a {
				display: block;
				width: 50%;
				float: left;
				text-align: center;
				line-height: 40px;
				color: #000;
			}
			
			.lang-btn a:hover {
				background: #222;
			}
			/*多语言*/
			/*.lang-zz{
				width: 100%;
				height: 100%;
				background: rgba(255,255,255,0.2);
				position: fixed;
				left: 0px;
				top: 0px;
				z-index: 999;
			}
			.lang-main{
				width: 260px;
				height: auto;
				position: fixed;
				background:black;
				left: 50%;
				margin-left: -130px;
				top: 50%;
				margin-top: -25%;
				border-radius: 5px;
			}
			.lang-main h5{
				color: white;
				font-size: 18px;
				text-align: center;
			}
			.langbox{
				width: 100%;
				height: 33px;
				padding: 0px 5%;
				line-height: 33px;
				color: #000;
			}
			.langbox span{
				float: right;
				line-height: 33px;
				
			}
			.lang-btn{
				width: 100%;
				height: 40px;
			}
			.lang-btn a{
				display: block;
				width: 50%;
				float: left;
				text-align: center;
				line-height: 40px;
				color: rgb(56,168,250);
			}
			.lang-btn a:hover{
				background: #222;
			}*/
			
			.mui-card {
				background: #E3E3E3;
			}
			
			.home_top {
				background: #05508a;
			}
			
			.mui-card .mui-table-view button {
				background: #05508a;
			}
			
			.mui-pull-right .setting_right {
				color: #006bff;
			}
			
			#contain {
				color: #05508A;
			}
			
			label {
				color: black;
				font-size: 14px;
			}
			
			h5 {
				color: black;
			}
		</style>

	</head>

	<body>
		<div class="lang-zz" id="lang-zz" style="display: none;">
			<div class="lang-main">
				<h5 lang style="color:black;">多语言</h5>
				<div class="langbox" data-lang="zh">
					<label>中文</label><span class="mui-icon" id="zh_lang"></span>
				</div>
				<div class="langbox" data-lang="en">
					<label>English</label><span class="mui-icon" id="en_lang"></span>
				</div>
				<div class="lang-btn">
					<a style="color:#05508a;" id="quxiao" lang>取消</a>
					<a id="contain" lang>确定</a>
				</div>
			</div>
		</div>

		<!-- 头部 -->
		<header class="mui-bar mui-bar-nav home_top">
			<div class="top_left">
				<img src="" id="headimg" width="56" height="56" />
				<div>
					<span class="nickname"><font lang>昵称</font><span id='nick_name'></span></span>
					<span class="uid"><font lang>UID</font><span id='user_name'></span></span>
					<span class="uid_xinyong"><font lang>信用</font><span id='user_score'></span></span>
				</div>
			</div>

			<a class="mui-pull-right change_tx" href="#picture" lang>更换头像</a>
		</header>

		<div class="mui-content" style="margin: 42px 4px 50px;">
			<div class="mui-card setting">
				<ul class="mui-table-view">
					<li class="mui-table-view-cell">
						<a class="mui-navigate-right" id="nikename">
							<!--<span class="mui-badge mui-badge-danger"></span>-->
							<span class="mui-pull-right setting_right" id="nike"></span>
							<span lang>昵称</span>
						</a>
					</li>

					<li class="mui-table-view-cell language" id="change_lang">
						<!-- <a class="mui-navigate-right">-->
						<span class="mui-pull-right setting_right" id="now_langage" style="color:#gray;">
		                    	中文
		                    </span>
						<span class="mui-pull-left" lang>语言</span>
						<!-- </a>-->
					</li>
					<li class="mui-table-view-cell">
						<a class="mui-navigate-right" id="card">
							<span lang>绑定支付</span>
							<span class="mui-pull-right setting_right">
		                    	<img src="img/unionpay.png" width="18px" height="12px" />
		                    	<span class="mui-icon iconfont icon-iconfontrectangle390"></span>
							<span class="mui-icon iconfont icon-weixinzhifu"></span>
							</span>
						</a>
					</li>

					<!--
		            <li class="mui-table-view-cell">
		                <a class="mui-navigate-right" href="pages/setting/my_asset.html" lang>
		                                                  我的资产
		                </a>
		            </li>-->

					<li class="mui-table-view-cell">
						<a class="mui-navigate-right" id="set_loginpwd" lang>
							登录密码
						</a>
					</li>
					<li class="mui-table-view-cell">
						<a class="mui-navigate-right" id="set_trade_pwd" lang>
							支付密码
						</a>
					</li>
					<li class="mui-table-view-cell">
						<a class="mui-navigate-right" id="change-phone" lang>
							手机号
						</a>
					</li>

					<li class="mui-table-view-cell">
						<a class="mui-navigate-right" id="notice" lang>
							公告
						</a>
						<div style="position: absolute;margin-top: -10px;width: 100%;padding-right: 60px;" class="leftAndRight">
							<span></span>
							<div style="color: white;background-size: 100% 100%;font-size: 12px;" class="divCenter">
								<img src="img/dot_bk.png" style="width: 6%;position: absolute;" />
								<span style="color: white;position: absolute;">1</span>
							</div>

						</div>
					</li>
					<li class="mui-table-view-cell" id="news">
						<a class="mui-navigate-right" lang>
							个人消息
						</a>
						<div style="position: absolute;margin-top: -10px;width: 100%;padding-right: 60px;" class="leftAndRight">
							<span></span>
							<div style="color: white;background-size: 100% 100%;font-size: 12px;" class="divCenter">
								<img src="img/dot_bk.png" style="width: 6%;position: absolute;" />
								<span style="color: white;position: absolute;">99</span>
							</div>

						</div>
					</li>

					<li class="mui-table-view-cell">
						<a class="mui-navigate-right" id="suggest" lang>
							投诉建议
						</a>
					</li>
					<!--新增我的店铺-->

					<li class="mui-table-view-cell">
						<a class="mui-navigate-right" id="mystore" lang>
							我的店铺
						</a>
					</li>
					<li class="mui-table-view-cell">
						<a class="mui-navigate-right" id="myorder" lang>
							我的订单
						</a>
					</li>
					<li class="mui-table-view-cell">
						<a class="mui-navigate-right" id="address" lang>
							地址管理
						</a>
					</li>

					<li class="mui-table-view-cell">
						<a class="mui-navigate-right" id="qr_code" lang>
							分享
						</a>
					</li>
					<li class="mui-table-view-cell">
						<a class="mui-navigate-right" id="update">
							<span style="float:left;" lang>版本</span>
							<span id="old_vesion" style="float:left;margin-left:8px;display:none;"></span>
							<span class="mui-pull-right setting_right" id="vesionid"></span>
						</a>
					</li>

					<li class="mui-table-view-cell">
						<a class="mui-navigate-right" id="about" lang>
							关于
						</a>
					</li>

					<button class="mui-btn mui-btn-block" id="out_login" lang>退出登录</button>
				</ul>
			</div>
		</div>

		<div id="picture" class="mui-popover mui-popover-action mui-popover-bottom">
			<ul class="mui-table-view">
				<li class="mui-table-view-cell">
					<a href="#" id="xiangce" lang>相册</a>
				</li>
				<li class="mui-table-view-cell">
					<a href="#" id="paizao" lang>拍照</a>
				</li>
			</ul>
			<ul class="mui-table-view">
				<li class="mui-table-view-cell">
					<a href="#picture" lang><b>取消</b></a>
				</li>
			</ul>
		</div>

		<!--底部导航-->
		<nav class="mui-bar mui-bar-tab " id="nav" style="background-color: #fff;">
			<a class="mui-tab-item" id="index.html">
				<span class="mui-icon iconfont iconshouye"></span>
				<span class="mui-tab-label" lang>首页</span>
			</a>
			<a class="mui-tab-item" id="pages/buy-in/buy_in.html">
				<span class="mui-icon iconfont iconjiaoyi"></span>
				<span class="mui-tab-label" lang>交易</span>
			</a>
			<a class="mui-tab-item" id="weep.html">
				<span class="mui-icon iconfont iconzhifu"></span>
				<span class="mui-tab-label" lang>支付</span>
			</a>
			<a class="mui-tab-item" id="mall/index_m.html">
				<span class="mui-icon iconfont iconshangcheng"></span>
				<span class="mui-tab-label" lang>商城</span>
			</a>

			<a class="mui-tab-item mui-active" id="setting.html">
				<img src="img/dot_bk.png" style="width: 2%;position: absolute;margin-left: 24px;margin-top: 4px;" />
				<span class="mui-icon iconfont iconzhanghu"></span>
				<span class="mui-tab-label" lang>我的</span>
			</a>
		</nav>

		<script src="js/mui.js"></script>
		<script src="js/config.js"></script>
		<script src="lang/setting.js"></script>
		<script src="js/common.js"></script>
		<script src="js/sockjs.js"></script>
		<script src="resource/index/guide.js"></script>
		<script src="resource/setting/setting.js"></script>
		<script type="text/javascript">
			mui.init();
			//console.log(lang);
			mui.plusReady(function() {
				var userinfo = app.getState() || {};
				var old_vesionid;
				var new_vesionid;
				var ios_url;

				// 获得当前新版本号
				mui.getJSON(apiurl + "Login/get_version/", null, function(data) {
					console.log(JSON.stringify(data));
					new_vesionid = data.version;
					ios_url = data.url;

					plus.runtime.getProperty(plus.runtime.appid, function(wgtInfo) {
						old_vesionid = wgtInfo.version;
						//console.log(JSON.stringify(old_vesionid));
						if(new_vesionid != old_vesionid) {
							document.getElementById('vesionid').innerHTML = lang('*发现新版本');
							document.getElementById('vesionid').style.color = '#f00';
							document.getElementById('old_vesion').style.display = 'block';
							document.getElementById('old_vesion').innerHTML = old_vesionid;
						} else {
							document.getElementById('vesionid').innerHTML = old_vesionid;
							document.getElementById('vesionid').style.color = '#dca74b';
						}
					})

				});

				document.getElementById('update').addEventListener('tap', function() {
					if(document.getElementById('vesionid').innerHTML != lang('*发现新版本')) {
						mui.toast('当前已是最新版本！')
						return;
					}

					var btnArray = ['下载更新', '取消'];
					mui.confirm('版本更新' + new_vesionid, new_vesionid + '下载更新提醒', btnArray, function(e) {
						if(e.index == 0) {
							if(mui.os.android) {
								downWgt();
							} else {
								//plus.runtime.openURL('http://cj.gunchung.com/index.php?c=download&index&id=20');
								plus.runtime.openURL(ios_url);
							}
						} else {
							//
						}
					});

				}, false);

				//检查更新
				// 更新应用资源 
				function installWgt(path) {
					plus.nativeUI.showWaiting("安装更新文件...");
					plus.runtime.install(path, {}, function() {
						plus.nativeUI.closeWaiting();
						console.log("安装更新文件成功！");
						plus.nativeUI.alert("应用资源更新完成!\n点击确定按钮重启完成升级", function() {
							plus.runtime.restart();
						});
					}, function(e) {
						plus.nativeUI.closeWaiting();
						console.log("安装更新文件失败[" + e.code + "]：" + e.message);
						plus.nativeUI.alert("安装更新文件失败[" + e.code + "]：" + e.message);
					});
				}

				function downWgt() {
					plus.nativeUI.showWaiting("下载更新文件...");
					// 实际项目中需要更换为自己服务器的地址 
					var wgtUrl = serverurl + "Uploads/release/legend.apk";

					plus.downloader.createDownload(wgtUrl, {
						filename: "_doc/update/"
					}, function(d, status) {
						if(status == 200) {
							console.log("下载更新成功：" + d.filename);
							plus.nativeUI.confirm("升级包下载完成，是否需要升级", function(e) {
								var sure = (e.index == 0) ? "Yes" : "No";
								if(sure == 'Yes') {
									installWgt(d.filename); // 安装wgt包 
								}
							})
						} else {
							console.log("下载更新失败！");
							plus.nativeUI.alert("下载更新失败！");
						}
						plus.nativeUI.closeWaiting();
					}).start();
				}

			})
		</script>
	</body>

</html>